package com.spa.infrastructure.service.storage;

import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FileStorageContext {

    private List<FileStorageService> fileStorageServiceList;

    public FileStorageContext(List<FileStorageService> fileStorageServiceList) {
        this.fileStorageServiceList = fileStorageServiceList;
    }

    public FileStorageService getFileStorageService(StorageType type) {
        return fileStorageServiceList.stream()
                .filter(fileStorageService -> fileStorageService.type().equals(type)).findFirst().orElseThrow();
    }
}
